public class test4{
	public static void main(String args[]) {
	char[] operator=new char[]{'+','-','*','/'};
Random random=new Random();
ArrayList<String> expression=new ArrayList<String>();
for(int i=0;i<num;i++){
    int n=random.nextInt(3)+3; //3-5个运算符
    int[] number=new int[n+1];
    String ex=new String();
    for(int j=0;j<=n;j++){
        number[j]=random.nextInt(100)+1; //4-5个数字
    }
    for(int j=0;j<n;j++){
        int s=random.nextInt(4);//随机选择某个运算符
        ex+=String.valueOf(number[j])+String.valueOf(operator[s]);///5+4+6+9
        if(s==3){number[j+1]=decide(number[j],number[j+1]);}
    }
    ex+=String.valueOf(number[n]);
    expression.add(ex);
}
ScriptEngine jse = new ScriptEngineManager().getEngineByName("JavaScript");
 ArrayList<String> calculate(ArrayList<String> arrayList){
    ArrayList<String> ArithExpress=new ArrayList<String>();
    for(String ax:arrayList){
        try {
            ax=ax+"="+jse.eval(ax);
            System.out.println(ax);
            ArithExpress.add(ax);
        } catch (ScriptException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    return ArithExpress;
}
	}
}

